ng911ok.tools.validation.validate module#

synopsis:

Validate Geodatabase

authors:

Riley Baird (OK), Emma Baker (OK)

class ValidateGeodatabase#

Bases: object

Class describing an ArcGIS Python Toolbox tool: “Validate Geodatabase”.

static _enable_feature_class_parameter(gdb: str, param_dict: dict[str, Parameter])#
execute(parameters, messages)#

The source code of the tool.

getParameterInfo()#

Define parameter definitions

isLicensed()#

Set whether tool is licensed to execute.

updateMessages(parameters: list[Parameter])#

Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.

updateParameters(parameters: list[Parameter])#

Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.

_all_available_validations_selected(parameters: Sequence[Parameter]) bool#

Returns whether all available routines AND all available feature classes have been selected. This may be True even if required feature classes are missing. Does not consider the run_all parameter.

_all_required_validations_selected(parameters: Sequence[Parameter]) bool#

Returns whether all routines AND all required feature classes have been selected. If any required feature classes are missing, this will return False, even though _all_available_validations_selected() may return True. Does not consider the run_all parameter.

_gdb_has_rds(gdb: str) bool#

Returns whether gdb contains the required feature dataset (RDS). Uses @lru_cache so that arcpy.ListDatasets does not need to be called every time a parameter is updated. A cache size of 1 is used to ensure that changing the value of gdb will produce a fresh result.

_get_parameter_index(parameters: Sequence[Parameter], name: str) int#

Given a list of arcpy.Parameter instances, returns the index of the Parameter in the list with a name attribute equal to name.

_get_routine_parameters(parameters: Sequence[Parameter]) list[Parameter]#

Given a list of arcpy.Parameter instances, returns only those which are for the selection of validation routines.

_param_set_enabled(parameter: Parameter, enable: bool, *, populate: bool = False, select_all: bool = False) bool#

Sets the enabled attribute to enable. If enable is False, clears the value and/or values attributes, if applicable.

If populate is True and parameter.enabled is being changed from False to True, ValidationRoutine.populate_parameter_value_table() is called.

Parameters:
  • parameter (arcpy.Parameter) – The arcpy.Parameter instance

  • enable (bool) – Whether to enable the parameter (if True) or disable it (if False); default True

  • populate (bool) – Whether to call ValidationRoutine.populate_parameter_value_table() with parameter. Will only work if parameter is a routine selection parameter (based, in part, on its name attribute). Ignored if enable is False or parameter.enabled is already True. Default False.

  • select_all (bool) – Whether to select all routines in the parameter. Will only work if parameter is a routine selection parameter (based, in part, on its name attribute). Ignored if enable is False. Default False.

Returns:

Whether the parameter is enabled or not

Return type:

bool

_routine_validate_selection(routine_parameter: Parameter, fc_parameter: Parameter) None#
get_feature_class_selections(parameters: Sequence[Parameter]) dict[str, bool]#

Returns a dict of feature class names and whether each is selected. Only includes the feature classes listed in the feature_classes_to_check parameter, which is automatically found among parameters.

get_routine_selections(parameters: Sequence[Parameter], enabled_only: bool = False) dict[str, bool]#

Returns a dict of routine names and whether each is selected.